#include <iostream>
#include <vector>
using namespace std;

const int N = 1e5 + 10;
vector<int> v[N];
int d[N]; // 儿子的数量.
int n;
// 全局最小值, 局部最大值
int minx = 1e5 + 10;

int dfs(int x, int f)
{
    if (d[x])
    {
        return d[x];
    }

    int mx = 0;
    d[x] = 1;
    for (auto c : v[x])
    {
        if (c != f)
        {
            int t = dfs(c, x);
            mx = max(mx, t);
            d[x] += t;
        }
    }
    
    mx = max(mx, n - d[x]);
    minx = min(minx, mx);
    return d[x];
}

int main()
{
    cin >> n;
    for (int i = 1; i <= n-1; i++)
    {
        int a, b;
        cin >> a >> b;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    dfs(1, 0);
    cout << minx << endl;
    return 0;
}
